package cn.itsource.mybatis;

import org.junit.Test;

public class TestMyBatis {

    @Test
    public void testMybatis() throws Exception{

        IUserDao userDao = new UserDaoImpl();
        System.out.println(userDao.getOne(1L));
    }

    //查询所有的内容
    @Test
    public void testGetAll() throws Exception{

        IUserDao userDao = new UserDaoImpl();
        System.out.println(userDao.getAll());
    }

    @Test
    public void testSave() throws Exception{

        IUserDao userDao = new UserDaoImpl();
        User user = new User();
        user.setName("张富明");
        userDao.save(user);
    }

    @Test
    public void testUpdate() throws Exception{

        IUserDao userDao = new UserDaoImpl();
        User user = new User();
        user.setId(3L);
        user.setName("张富民");
        userDao.update(user);
        System.out.println("-------------");
    }

    @Test
    public void testDelete() throws Exception{

        IUserDao userDao = new UserDaoImpl();
          userDao.delete(3L);
    }
}
